package com.xbongbong.saas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;

/**
 * 业绩目标日志相关枚举
 *
 * @author zyy
 * @date 2022/03/21/ 16:01:00
 * @since v1.0
 */
public enum PerformanceLogEnum {

    NAME("name","enum.performanceLog.name.name"),
    SOURCE_ATTR("sourceAttr", "enum.performanceLog.name.source_attr"),
    BELONG_ATTR("belongAttr", "enum.performanceLog.name.belong_attr"),
    TIME_ATTR("timeAttr", "enum.performanceLog.name.time_attr"),
    MEMO("memo","enum.performanceLog.name.memo"),
    PERMISSIONS("permissions","enum.performanceLog.name.permissions"),
    MINCYCLE("minCycle","enum.performanceLog.name.min_cycle"),
    ASSESSTYPE("assessType","enum.performanceLog.name.assess_type"),
    STATISTICSWAY("statisticsWay","enum.performanceLog.name.statistics_way"),
    UNIT("unit","enum.performanceLog.name.unit"),
    PENETRATEATTR("penetrateAttr","enum.performanceLog.name.penetrate_attr"),
    DRIVERSOURCES("driverSources","enum.performanceLog.name.driver_sources");


    private String key;
    private String name;

    PerformanceLogEnum(String key, String name) {
        this.key = key;
        this.name = name;
    }

    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }

    public static String getNameByKey(String key){
        for (PerformanceLogEnum performanceLogEnum : values()) {
            if(performanceLogEnum.key.equals(key)){
                return I18nMessageUtil.getMessage(performanceLogEnum.name);
            }
        }
        return null;
    }
}
